home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Bin / DXUtils / Visual Studio 6.0 Wizards / DMToolWizard.awx / TEMPLATE / CLASSNAME.H < prev    next >
Encoding:
C/C++ Source or Header  |  2002-12-11  |  6.8 KB  |  201 lines

  1. //------------------------------------------------------------------------------
  2. // File: $$CLASS_NAME$$.h
  3. //
  4. // Desc: DirectMusicTool Wizard generated code - Definition of $$CLASS_NAME$$
  5. //
  6. // Author: $$TOOL_AUTHOR$$
  7. //
  8. // Copyright (c) Microsoft Corporation.  All rights reserved.
  9. //------------------------------------------------------------------------------
  10.  
  11. /////////////////////////////////////////////////////////////////////////////
  12. // TODO List: 
  13. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  14. //  - Add the DMTool parameters to the $$TOOLID_NAME$$FilterParams enumeration
  15. //  - Provide information about the DMTool parameters in the g_params array
  16. $$ENDIF
  17. //  - Add memeber variables / functions
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20.  
  21. #ifndef __$$CLASS_NAME$$_H_
  22. #define __$$CLASS_NAME$$_H_
  23.  
  24. #include "resource.h"
  25. #define FIX_LOCK_NAME
  26. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  27. #include "param.h"        // (param.h must come before uuids to avoid redefinitions)
  28. $$ENDIF
  29. #include "dmusici.h"
  30. #include "$$DLL_NAME$$.h"    // $$TOOL_NAME$$ Interface
  31.  
  32. $$IF(SUPPORT_DM_DMP) // If supports DirectMusic Producer
  33. #define FOURCC_TOOL_CHUNK   mmioFOURCC($$TOOL_RIFF_ID$$)
  34. $$ENDIF    // End => if supports DirectMusic Producer
  35. $$IF(!EMPTY_TOOL) // Sample tool
  36. #define MAX_ECHOES        4
  37. #define N_8TH            DMUS_PPQ / 2    // Length of an 8th note
  38. $$ENDIF // End => Sample tool
  39.  
  40. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  41. ///////////////////////////////////////////////////////////////////////////////
  42. // Parameter Info
  43. //
  44. const MP_CAPS g_capsAll = MP_CAPS_CURVE_JUMP | MP_CAPS_CURVE_LINEAR | MP_CAPS_CURVE_SQUARE | MP_CAPS_CURVE_INVSQUARE | MP_CAPS_CURVE_SINE;
  45.  
  46. // TODO: Add the DMTOOL parameters to the enumeration
  47. enum $$TOOLID_NAME$$FilterParams
  48. {
  49. $$IF(EMPTY_TOOL)
  50.     $$TOOL_DEFINE$$_PARAM1 = 0,    // NOTE: $$TOOL_DEFINE$$_PARAM1 is provided as an example    
  51. $$ELSE    // Sample DMTool
  52.     ECHO_NUMBER = 0,
  53.     ECHO_DELAY,
  54. $$ENDIF
  55. };
  56.  
  57. ///////////////////////////////////////////////////////////////////////////////
  58. // The ParamInfo struct is defined as:
  59. //   typedef struct _ParamInfo
  60. //   {
  61. //        DWORD dwIndex;              // Index for the parameter
  62. //        MP_PARAMINFO    MParamInfo; // Parameter info
  63. //        WCHAR *         pwchText;   // Text name for the parameter
  64. //   } ParamInfo;
  65. ///////////////////////////////////////////////////////////////////////////////
  66. // TODO: Provide information about the DMTool parameters
  67. static ParamInfo g_params[] =
  68. {
  69. //    index                    type        caps        min,    max,  neutral,    unit text,  label,        parameter name
  70. $$IF(EMPTY_TOOL)
  71.     $$TOOL_DEFINE$$_PARAM1,MPT_INT,    g_capsAll,        0,        100,    0,        L"units",    L"Param1",    L"Param1",
  72. $$ELSE    // Sample DMTool
  73.     ECHO_NUMBER,            MPT_INT,    g_capsAll,    1,        4,        3,        L"",        L"Number",    L"Number",
  74.     ECHO_DELAY,                MPT_INT,    g_capsAll,    1,        1000,    N_8TH,    L"",        L"Delay",    L"Delay",
  75. $$ENDIF
  76. };
  77. ///////////////////////////////////////////////////////////////////////////////
  78. ///////////////////////////////////////////////////////////////////////////////
  79. $$ENDIF
  80.  
  81. /////////////////////////////////////////////////////////////////////////////
  82. // $$CLASS_NAME$$
  83. class ATL_NO_VTABLE $$CLASS_NAME$$ : 
  84.     public CComObjectRootEx<CComMultiThreadModel>,
  85.     public CComCoClass<$$CLASS_NAME$$, &CLSID_$$TOOL_DEFINE$$>,
  86.     public IDirectMusicTool8,
  87. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  88.     public CParamsManager,
  89.     public CParamsManager::UpdateCallback,
  90.     public IPersistStream,
  91. $$ENDIF
  92. $$IF(SUPPORT_DM_DMP)
  93.     public ISpecifyPropertyPages,
  94. $$ENDIF
  95.     public $$INTERFACE_NAME$$
  96. {
  97. public:
  98.     $$CLASS_NAME$$();    // Constructor
  99.     ~$$CLASS_NAME$$();    // Destructor
  100.  
  101. DECLARE_REGISTRY_RESOURCEID(IDR_$$TOOL_DEFINE$$)
  102. DECLARE_GET_CONTROLLING_UNKNOWN()
  103.  
  104. DECLARE_PROTECT_FINAL_CONSTRUCT()
  105.  
  106. BEGIN_COM_MAP($$CLASS_NAME$$)
  107.     COM_INTERFACE_ENTRY_IID(IID_IDirectMusicTool, IDirectMusicTool)
  108.     COM_INTERFACE_ENTRY_IID(IID_IDirectMusicTool8, IDirectMusicTool8)
  109. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  110.     COM_INTERFACE_ENTRY(IMediaParams)
  111.     COM_INTERFACE_ENTRY(IMediaParamInfo)
  112.     COM_INTERFACE_ENTRY(IPersistStream)
  113. $$ENDIF
  114. $$IF(SUPPORT_DM_DMP)
  115.     COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  116. $$ENDIF
  117.     COM_INTERFACE_ENTRY_IID(IID_$$INTERFACE_NAME$$, $$INTERFACE_NAME$$)
  118.     COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  119. END_COM_MAP()
  120.  
  121.     HRESULT FinalConstruct()
  122.     {
  123.         return CoCreateFreeThreadedMarshaler(
  124.             GetControllingUnknown(), &m_pUnkMarshaler.p);
  125.     }
  126.  
  127.     void FinalRelease()
  128.     {
  129.         m_pUnkMarshaler.Release();
  130.     }
  131.  
  132.     CComPtr<IUnknown> m_pUnkMarshaler;
  133.  
  134. public:
  135.     // IDirectMusicTool
  136.     STDMETHODIMP Init(IDirectMusicGraph* pGraph) ;
  137.     STDMETHODIMP GetMsgDeliveryType(DWORD* pdwDeliveryType ) ;
  138.     STDMETHODIMP GetMediaTypeArraySize(DWORD* pdwNumElements ) ;
  139.     STDMETHODIMP GetMediaTypes(DWORD** padwMediaTypes, DWORD dwNumElements) ;
  140.     STDMETHODIMP ProcessPMsg(IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG) ;
  141.     STDMETHODIMP Flush(IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG, REFERENCE_TIME rt) ;
  142.  
  143.     // IDirectMusicTool8
  144.     STDMETHODIMP Clone( IDirectMusicTool ** ppTool) ;
  145.  
  146. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  147.     // SetParam handling
  148.     STDMETHODIMP SetParam(DWORD dwParamIndex,MP_DATA value) { return SetParamInternal(dwParamIndex, value, false); }
  149.     HRESULT SetParamUpdate(DWORD dwParamIndex, MP_DATA value) { return SetParamInternal(dwParamIndex, value, true); }
  150.     HRESULT SetParamInternal(DWORD dwParamIndex, MP_DATA value, bool fSkipPasssingToParamManager);
  151.  
  152.     // IPersist Methods
  153.     STDMETHODIMP STDMETHODCALLTYPE GetClassID(CLSID* pClassID);
  154.  
  155.     // IPersistStream Methods
  156.     STDMETHODIMP STDMETHODCALLTYPE IsDirty();
  157.     STDMETHODIMP STDMETHODCALLTYPE Load(IStream* pStream);
  158.     STDMETHODIMP STDMETHODCALLTYPE Save(IStream* pStream, BOOL fClearDirty);
  159.     STDMETHODIMP STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER* pcbSize);
  160. $$ENDIF
  161.  
  162. $$IF(SUPPORT_DM_DMP)
  163.     // ISpecifyPropertyPages Methods
  164.     STDMETHODIMP GetPages(CAUUID *pPages);
  165. $$ENDIF
  166.  
  167.     // $$INTERFACE_NAME$$ Methods
  168. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  169.     STDMETHOD(SetAllParameters)        (THIS_ LPC$$TOOLID_NAME$$Params pParm);
  170.     STDMETHOD(GetAllParameters)        (THIS_ LP$$TOOLID_NAME$$Params pParm);
  171. $$ENDIF
  172.  
  173. $$IF(EMPTY_TOOL)
  174. // TODO: Add your custom interface methods here
  175.  
  176. $$ELSE // Sample Tool
  177.     // IEchoTool
  178.     STDMETHODIMP_(void) SetEchoNum( DWORD dwEchoNum );
  179.     STDMETHODIMP_(void) SetDelay( MUSIC_TIME mtDelay );
  180. $$ENDIF
  181.  
  182. private:
  183.     // States of the DMTool
  184. $$IF(SUPPORT_DM_IMEDPARAM || SUPPORT_DM_DMP)
  185.     bool    m_fDirty;
  186. $$ENDIF
  187.     bool    m_fInitialized;
  188.  
  189. $$IF(EMPTY_TOOL)
  190. // TODO: Declare memeber variables here. m_dwParam1 is provided as an example
  191.     DWORD    m_dwParam1;    // TODO: Rename this variable to your friendly name
  192.  
  193. $$ELSE // Sample Tool
  194.     DWORD        m_dwEchoNum;        // Number of echoes to generate
  195.     MUSIC_TIME    m_mtDelay;        // Delay time between echoes
  196. $$ENDIF
  197. };
  198.  
  199. #endif //__$$CLASS_NAME$$_H_
  200.  
  201.